package com.rzjm.api.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.rzjm.api.dao.DeviceWaterCardMapper;
import com.rzjm.api.entity.DeviceWaterCard;
import com.rzjm.api.service.IDeviceWaterCardService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 水机的水卡列Service业务层处理
 *
 * @author ruoyi
 * @date 2025-01-07
 */
@Service
public class DeviceWaterCardServiceImpl extends BaseServiceImpl<DeviceWaterCardMapper, DeviceWaterCard> implements IDeviceWaterCardService {

    @Resource
    private DeviceWaterCardMapper waterCardMapper;

    @Override
    public DeviceWaterCard getWaterCardByIcId(String idCardId) {
        QueryWrapper<DeviceWaterCard> qw = new QueryWrapper<>();
        qw.eq("ic_card_id", idCardId);
        qw.last("limit 1");
        return waterCardMapper.selectOne(qw);
    }

    @Override
    public DeviceWaterCard getWaterCardByNum(String carNum) {
        QueryWrapper<DeviceWaterCard> qw = new QueryWrapper<>();
        qw.eq("card_num", carNum);
        qw.last("limit 1");
        return waterCardMapper.selectOne(qw);
    }
}
